﻿
$(function () {
    $.fn.textClip = TextClip;
    $(".TextClip").textClip(12, "..");

})





//this - jquery collection
function TextClip(limit, spacing) {
    if (!this instanceof jQuery || limit- spacing.length <= 0)
        return false;
    this.each(function () {
        var a = $(this);
        if (a.text().length > limit) {
            a.text(a.text().slice(0, limit - spacing.length) + spacing);
        }
    })

}